package strcy.cn.market.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import strcy.cn.market.pojo.Orders;
import strcy.cn.market.pojo.VO.OrderRequest;

import java.util.List;

@Mapper
public interface OrdersMapper {
    // 新建订单
    @Insert("insert into orders(order_id, user_id, order_status, total_amount, order_date) " +
            "values (#{orderId},#{userId},#{orderStatus},#{totalAmount},now())")
    void add(Orders orders);
    //修改订单状态
    @Update("update orders set order_status=#{orderStatus},pay_time=now() where order_id=#{orderId}")
    void update(String orderId, Integer orderStatus);
    //获取个人订单列表
    @Select("select * from orders where user_id = #{userId}")
    List<Orders> list(Integer userId);
    //获取订单列表
    @Select("select * from orders  ")
    List<Orders> lists();
}
